<?php
namespace  App\Http\Controllers;

use App\Models\ServiceType;
use Illuminate\Http\Request;

class ServiceTypeController extends Controller
{
    public function index(Request $request,ServiceType $serviceType){
        $res = $serviceType->where('status',1)->get();
        if($res && !$res->isEmpty()){
            return $this->return_json(200,$res,'查询成功');
        }else{
            return $this->return_json(201,'','查询失败');
        }
    }

    public function save(Request $request,ServiceType $serviceType){
        $param = $request->all();
        $param['status'] = 1;
        $code = $serviceType->create($param);
        if($code){
            return $this->return_json(200,'','添加成功');
        }else{
            return $this->return_json(201,'','添加失败');
        }
    }

    public function update(){

    }

    public function delete(){

    }

}
